import { GET, PUT, POST, DELETE } from '@/utils/request'
import { objToQuery } from '@/utils/param'
/**
 * 获取订单
 * @params pageNum: Number 页码
 * @params pageSize: Number 页码大小
 * @params resourceId: Number 附件ID
 * @params projectId: Number 项目ID
 * @params userId: Number 用户ID
 * @params orderId: Number 订单ID
 */
export const getProjectOrders = (params) => GET(`/admin/project/resource/purchased`, params)

/**
 * 订单关联客服
 * @param {Number} scpId 付款id
 */
export const connectOrderWithService = (scpId) => PUT(`/seniorManagement/connectOrderWithService/${ scpId }`)

/**
 * 更新订单状态
 * @param {Number} scpId
 * @param {Number} status 0:未对接 1:已对接 2:异常
 * @param {String} scpNote 备注信息
 */
export const updateOrderStatus = ({ scpId, status, scpNote = '' }) => PUT(`/seniorManagement/updateSCPStatus/${ scpId }/${ status }${ objToQuery({ scpNote }) }`)

/**
 * 更新订单的会议信息
 * @param {Number} scpId
 * @param {String} scpConferenceInfo 会议信息
 */
export const updateOrderMeetingInfo = ({ scpId, scpConferenceInfo }) => PUT(`/seniorManagement/addConferenceInfo/${ scpId }${ objToQuery({ scpConferenceInfo }) }`)

/**
 * 退款
 * @param {Number} orderId 订单id
 */
export const refundOrder = (orderId) => PUT(`/contribPoint/refund/${ orderId }`)

/**
 * 获取学长学姐订单列表
 * @param {String} type 类型
 * @param {String} sortCode 筛选模式
 * @param {String} modChoiceCode 正序或是倒序
 * @param {Number} pageNum
 * @param {Number} pageSize
 */
export const getConsultOrder = (params) => GET(`/seniorManagement/getRoughPageable`, params)

/**
 * 获取学长学姐订单详情
 */
export const getConsultOrderDetail = (id) => GET(`/seniorManagement/getDetail/${ id }`)

/**
  * 获取咨询文件列表
  * @param {Number} payId 支付id
  */
export const getConsultFiles = (payId) => GET(`/seniorProblem/selectProblemByPayId`, { payId })

/**
 * 修改订单预约时间
 */
export const updateMeetingTime = ({ orderId, ...data }) => PUT(`/seniorManagement/modifySeniorConsultTime/${ orderId }`, data)
